const express = require('express');
const router = express.Router();

router.get('/', (req, res) => {
    const content = [];
    for(let i = 0; i < 40; i++) content.push({
        id: `${i + 1}`,
        dealerCode: 'string',
        partInvoiceCode: 'string',
        currency: 1,
        invoiceAmount: 100,
        invoicedDate: '2019-09-07T08:17:54.995Z',
        status: 1,
        partShipmentCode: 'string',
        options: [
            'signfor'
        ]
    });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 40,
        }
    });
});
router.get('/:id', (req, res) => {
    res.json(
        {
            message: 'string',
            payload: {
                id: '1',
                partInvoiceCode: 'string',
                invoiceAmount: 10,
                currency: 1,
                status: 1,
                invoicedDate: '2019-09-07T08:19:12.190Z',
                partShipmentCode: 'string',
                shipmentType: 1,
                origin: 'string',
                destination: 'string',
                expectShipmentDate: '2019-09-07T08:19:12.190Z',
                declarePlace: 1,
                declareType: 1,
                lcCode: 'string',
                receipterName: 'string',
                receiptTime: '2019-09-07T08:19:12.190Z',
                rowVersion: 'rowVersion',
                packingListDetails: [
                    {
                        id: '1',
                        packingListCode: 'string',
                        packing: 1,
                        container: 'string',
                        length: 4,
                        width: 5,
                        height: 6,
                        volume: 7,
                        netWeight: 8,
                        grossWeight: 9
                    },
                ],
                partOrderPIDetails: [
                    {
                        id: '1',
                        partSaleOrderCode: 'string',
                        partOrderPICode: 'string',
                        currency: 1,
                        partCode: 'string',
                        partName: 'string',
                        quantity: 10,
                        price: 20,
                        totalAmount: 200
                    },
                ],
                attachments: [{
                    fileId: 'te1232-131232-1we',
                    fileName: '安装背景图1'
                },
                {
                    fileId: 'qww1-232131-12e',
                    fileName: '安装背景图2'
                }],
                options: [
                    'signfor',
                ],
            }
        }
    );
});

router.put('/:id', (req, res) => {
    res.json({
        message: '签收成功'
    });
});

module.exports = router;
